﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Streambolics
{
    public abstract class SynchronousJobProcessor<T> : JobProcessor<T> where T : Job
    {
        protected abstract void DoProcess (T aJob);
        protected override void Process (T aJob)
        {
            try
            {
                DoProcess (aJob);
            }
            catch (Exception e)
            {
                DeclareFailed (e);
            }
            Complete ();
        }

        protected override void DoStart ()
        {
            DeclareStarted ();
        }

        protected override void DoStop ()
        {
            DeclareStopped ();
        }
    }
}
